﻿using STHPMS1.ICore.I_Entity;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace STHPMS1.ICore.I_DAL.Repository
{
    public interface IDn_Divi_ResultRepository : IDal
    {
        #region 模型处理
        IEnumerable<T> GetEsalage<T>(string segid) where T : class, IDm_Esalage;
        T GetModelGroup<T>(string groupId) where T : class,IDm_Modelgroup;
        #endregion


        /// <summary>
        /// 中修的上面层和中面层厚度
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        DataTable GetThick_Up_Midlle(string id);
        DataTable GetThick_Up_Midlle_Down(string id);
        string GetMeas_ini(string anniname, int year);
        /// <summary>
        /// 查询面层厚度
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        double GetThick_S(string rdid, int dir, double start, double end);
        /// <summary>
        /// 查询当年度该决策路段的各项平均指标
        /// </summary>
        /// <param name="r"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        DataRow GetTe_Data(IDn_Divi_Result r);
        /// <summary>
        /// 根据路网对象查询适合该路网的决策路段
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="roadnet"></param>
        /// <returns></returns>
        IEnumerable<T> GetResulst<T>(IB_Roadnet roadnet) where T : class, IDn_Divi_Result;
        /// <summary>
        /// 更新养护路段的养护方式和划分方式
        /// </summary>
        /// <param name="diviList"></param>
        void Update(IDn_Divi_Result[] diviList);
        /// <summary>
        /// 返回养护路段和单元的平均评价值
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        DataTable GetRoadAvgZB(string rdid, string dir);
        /// <summary>
        /// 返回本年度的养护方案(养护类型和划分时间)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <returns></returns>
        IEnumerable<T> GetMainNeedWay<T>(string rdwaryId) where T : class, IDn_Divi_Result;
        /// <summary>
        /// 删除指定划分类型的养护路段和关联单元
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="gf_zb"></param>
        void Clear(string rdid, string gf_zb);

        /// <summary>
        /// 删除指定路线中非此类划分类型的养护路段和关联单元
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="gf_zb"></param>
        void ClearOther(string rdid, string gf_zb);

        /// <summary>
        /// 删除指定路线和方向的养护路段和关联单元
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        void ClearOtherChart(string rdid,string dir);
        
        /// <summary>
        /// 根据路线和方向方法最新的路段划分结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        IEnumerable<T> GetNewSegment<T>(string rdwaryId, string m_w, ICore.I_Entity.Info.IPagingInfo info)
               where T : class, IDn_Divi_Result;

        /// <summary>
        /// 查询该方向的最新养护路段
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <param name="dir"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        IEnumerable<T> GetNewRoad<T>(string rdwaryId, string dir, ICore.I_Entity.Info.IPagingInfo info)
           where T : class, IDn_Divi_Result;

        /// <summary>
        /// 获取养护路段关联的单元信息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <returns></returns>
        IEnumerable<T> GetMainSegmentUnit<T>(string rdwaryId)
            where T : class, IB_Invntory_Unit;


        int GetLastYear(string rdwayid, string mainsegid);

        double GetRoadLenght(string rdwayid, string mainsegid);
        double GetRoadAera(string rdwayid, string mainsegid);
    }
}
